﻿@{
    ViewBag.Title = "RptMallGoodsSum";
}

@section scripts
{   
    <script src="@Url.Content("~/Scripts/shared/share.js")" type="text/javascript"></script> 
    <script src="@Url.Content("~/Scripts/shared/shown.js")" type="text/javascript"></script>  
    <script src="@Url.Content("~/Scripts/common/gridlayout.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/common/export.js")" type="text/javascript"></script>
}
<body>
   <form id="form1" runat="server" method="post" style="height: 100%">
    
    @Html.Partial("~/Views/Modular/ReportsToolbar.cshtml")
    
    <div id = "DivHeader">
        <table>
            <tr>
                <td width = "70px" align="right">时间段：</td>
                <td  width = "482px">
                    @Html.Partial("~/Views/Modular/dxDateTimeRange.cshtml")
                </td>
            </tr>
        </table>
        <table>
            <tr>
                <td width ="70px" align="right">商户名称：</td>
                <td width ="190px">    
                     @Html.Partial("~/Views/Modular/LookupCorpInfo.cshtml")
                </td>
                <td width = "70px" align="right">门店名称：</td>
                <td width = "190px">
                    @Html.Partial("~/Views/Modular/LookupStockInfo.cshtml")  
                </td>
                <td width ="70px" align="right">会员卡号：</td>
                <td width ="200px">    
                    @Html.Partial("~/Views/Modular/LookupMember.cshtml")            
                </td>
            </tr>
            <tr>
                <td width ="70px" align="right">商品分类：</td>
                <td width ="190px">    
                    @Html.Partial("~/Views/Modular/LookupGoodsClass.cshtml")                       
                </td>
                <td width ="70px" align="right">商品属性：</td>
                <td width ="190px">    
                    @Html.Partial("~/Views/Modular/LookupGoodsBrand.cshtml")                       
                </td>
                <td width ="70px" align="right">商品搜索：</td>
                <td width ="200px">
                    <input name="FNumber" class="mini-textbox" style="width:200px;"/>
                </td>
            </tr>
        </table>
    </div>
    <div class="mini-fit">
        <div id="datagrid1" class="mini-datagrid" style="width:100%;height:100%;" borderStyle="border:1;"pageSize="15"
            url="../Report/GetCommonReport"
            allowCellSelect="true" allowCellEdit="true" showSummaryRow="true" ondrawsummarycell="onDrawSummaryCell"
            fitColumns="false" onrowdblclick="editBill" sortMode="client">
            <div property="columns">
                <div field="CorpName" name="CorpName" width="120" headerAlign="center">商户名称</div>
                <div field="FNumber" width="90" headerAlign="center">商品编码</div>
                <div field="FCode" width="110" headerAlign="center">商品条码</div>
                <div field="FName" width="150" headerAlign="center">商品名称</div>
                <div field="FSpec" width="80" headerAlign="center">规格型号</div>
                <div field="FUnitName" width="40" headerAlign="center">单位</div>
                <div field="mFQty" name="mFQty" width="70" headerAlign="center"align="right" numberFormat="#,0.00">数量</div>
                <div field="mFActualAmount" name="mFActualAmount" width="90" headerAlign="center"align="right" numberFormat="#,0.00">金额</div>
                <div field="mFCostAmount" name="mFCostAmount" width="90" headerAlign="center"align="right" numberFormat="#,0.00">成本金额</div>
                <div field="mFProfitAmt" name="mFProfitAmt" width="90" headerAlign="center"align="right" numberFormat="#,0.00">毛利金额</div>
                <div field="mFProfitRate" name="mFProfitRate" width="70" headerAlign="center"align="right" numberFormat="#,0.00">毛利率</div>                
                <div field="FClassNumber" width="80" headerAlign="center">分类编码</div>
                <div field="FClassName" width="120" headerAlign="center">分类名称</div>
                <div field="FBrandName" width="100" headerAlign="center">商品属性</div>
            </div>
        </div>  
    </div>
    
    <script type="text/javascript">
        mini.parse();
        var form = new mini.Form("form1");
        var grid = mini.get("datagrid1");
        var uID = parent.window.getSystemAppID();
        var hdatatype = getQueryString("datatype");
        var sumFields = "mFQty,mFAmount,mFCostAmount,mFProfitAmt";

        function FormShown() {
            var nowDate = new Date();
            mini.getbyName("FDateTime1").setValue(dateToStr(nowDate, 1));
            mini.getbyName("FDateTime2").setValue(dateToStr(nowDate, 2));
            getDate();
            LoadData();
        }

        function getDate() {
            var nowDate = new Date();
            var currentMonth = nowDate.getMonth();
            var dtStart = new Date(nowDate.getFullYear(), currentMonth, 1);
            var nextMonth = ++currentMonth;
            var nextMonthFirstDay = new Date(nowDate.getFullYear(), nextMonth, 1);
            var oneDay = 1000 * 60 * 60 * 24;
            var dtEnd = new Date(nextMonthFirstDay - oneDay);
            mini.getbyName("FDateTime1").setValue(dateToStr(dtStart, 1));
            mini.getbyName("FDateTime2").setValue(dateToStr(dtEnd, 2));
        }

        function clearloca() {
            mini.getbyName("FMemberNumber").setValue("");
            mini.getbyName("FMemberNumber").setText(""); 
            mini.getbyName("FMemberName").setValue("");
            mini.getbyName("FCorpItemID").setValue("");
            mini.getbyName("FCorpItemID").setText("");
            mini.getbyName("FCorpName").setValue("");
            mini.getbyName("FStockID").setValue("");
            mini.getbyName("FStockID").setText("");
            mini.getbyName("FStockName").setValue("");
            mini.getbyName("FClassNumber").setValue("");
            mini.getbyName("FClassNumber").setText("");
            mini.getbyName("FGoodsClassName").setValue("");
            mini.getbyName("FNumber").setValue("");
            mini.getbyName("FBrandItemID").setValue("");
            mini.getbyName("FBrandItemID").setText("");
            mini.getbyName("FBrandName").setValue("");
        }

        function LoadData() {
            var cDateTime1 = mini.getbyName("FDateTime1").getFormValue();
            var cDateTime2 = mini.getbyName("FDateTime2").getFormValue();
            var mMemberID = mini.getbyName("FMemberNumber").getValue();
            var mStockID = mini.getbyName("FStockID").getValue();
            var mClassID = mini.getbyName("FClassNumber").getValue();
            var mBrandID = mini.getbyName("FBrandItemID").getValue();
            var mNumber = mini.getbyName("FNumber").getValue();
            var mSonCorpID = mini.getbyName("FCorpItemID").getValue();

            var json = "[{";
            json = json + '"mReportType":' + '"3003",';//列表类型
            json = json + '"mSystemAppID":' + '"' + uID + '",';
            json = json + '"mDateTime1":' + '"' + cDateTime1 + '",';
            json = json + '"mDateTime2":' + '"' + cDateTime2 + '",';
            json = json + '"mStockID":' + '"' + mStockID + '",';
            json = json + '"mMemberID":' + '"' + mMemberID + '",';
            json = json + '"mBrandID":' + '"' + mBrandID + '",';
            json = json + '"mClassID":' + '"' + mClassID + '",';
            json = json + '"mSonCorpID":' + '"' + mSonCorpID + '",';
            json = json + '"mNumber":' + '"' + mNumber + '"';
            json = json + "}]";

            grid.load({ mydata: json });

            mExportDataUrl = grid.url;
            mExportDataJson = json;//导出
        }

        function printdata() {
            var url = "../Report/PrintReport";
            mini.open({
                url: url,
                title: "打印", width: 1000, height: 700,
                onload: function () {
                    var iframe = this.getIFrameEl();
                    var NoneDisplayCol = [];
                    iframe.contentWindow.InitalPrint(grid, NoneDisplayCol, parent.window.getSystemCompany() + "电商商品销售表");
                }
            });
        }

    </script>

    </form>
</body>

